{extend name="layout:base" /}{block name="content"}
<?php
$global=isSupperManagerForSession();
?>
<style>
.table th{text-align:center;}
.tip{position:absolute;background:#9FC;border-color:#F60;z-index:9999;filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity: 0.8;opacity: 0.8;

.hidden-detail{display:none;}
.mypointer{width:95%;overflow:hidden;height:25px;line-height:25px;cursor: pointer;}
</style>

<link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />
<script src="/static/mimi/js/confirm/js/jquery-1.9.1.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="/static/mimi/css/animate.min.css" type="text/css" />
<link rel="stylesheet" href="/static/mimi/css/font-awesome.min.css" type="text/css" />
   
<section class="topBanners">
   <div class="icon"></div>
   <div class="topBannersNav">
   		<span data-url="/admin/sleepapilog/lists" onclick="ContentLoadGo('/admin/sleepapilog/lists')">睡眠数据管理</span>
   </div>
</section>
   
<section id="serach_section" style="margin-top:10px;margin-left:auto;margin-right:auto;">
      <select name="ser_key" id="ser_key" class="select" >
       <option value="uid" <?php if($request['ser_key']=="uid"){echo 'selected';} ?>>用户ID</option>
       <option value="uname" <?php if($request['ser_key']=="uname"){echo 'selected';} ?>>用户账号</option>
      </select>
      <input type="text" class="textbox" name="ser_val" id="ser_val" value="<?php echo $request['ser_val']; ?>" placeholder=""/>


      <input type="button" value="搜索" class="group_btn research" id="resource" page="1" />

      <br style="clear:both;width:0px;height:0px;">
</section>
 
<table class="table" style="margin-top:10px;">
<tr>
<th style="width:50px;">ID</th>
<th style="width:100px;">时间</th>
<th style="width:150px;">用户信息</th>
<th style="width:100px;">设备类型</th>
<th style="width:100px;">设备编号</th>

<th style="width:50px;">dataid</th>
<th style="width:100px;">状态</th>
<th style="width:50px;">操作</th>
</tr>
<?php 
foreach($lists['data'] as $key=>$val)
{
?>
<tr data-id="<?php echo $val['id']; ?>" data-s_id="<?php echo $val['s_id']; ?>"  dataid="<?php echo $val['s_dataid'] ?>">
<td style="text-align:left;"><?php echo $val['s_id']; ?></td>
<td style="text-align:left;"><?php echo $val['s_ctime']; ?></td>
<td style="text-align:left;">[<?php echo $val['s_uid']; ?>]&nbsp;[<?php echo $val['uname']; ?>]&nbsp;[<?php echo $val['nickname']; ?>]
<td style="text-align:left;"><?php if(empty($val['ty'])){echo '100B';}elseif($val['ty']==1){echo '100C';} ?></td>
<td style="text-align:left;"><?php echo $val['device']; ?></td>
<td style="text-align:left;"><?php echo $val['s_dataid']; ?></td>
<td style="text-align:left;">

    <?php
if($val['sleepData'])
{
  ?>
    <div class="mypointer" data-toggle="tooltip"
         data-placement="bottom" title="" style="text-align: left;">有</div>

    <?php
}else
{
  ?>
    <div class="mypointer" data-toggle="tooltip"
         data-placement="bottom" title="[<?php echo $val['taskLog']['result'] ?>，<?php echo $val['taskLog']['ctime']; ?>，<?php echo $val['taskLog']['key'] ?>]" style="text-align: left;">
        无[<?php echo $val['taskLog']['result'] ?>，<?php echo $val['taskLog']['ctime']; ?>，<?php echo $val['taskLog']['key'] ?>]</div>
    <?php
}
?>
</td>

<td style="text-align:right;">

    <?php
    if(empty($val['sleepData']))
    {
        if( ( in_array(30400,$ruleLists) || $global==1) )
        {
        ?>
            <input type="button" power="30400" value="抓取数据" class="link_btn dataGet"/>
            <?php
        }
    }
?>
    <?php
if($val['sleepData'])
{
  ?>
    <input type="button" power="30400" value="数据" class="link_btn info"/>
    <?php
}
?>
<?php
if( ( in_array(30400,$ruleLists) || $global==1) )
{
?>
<input type="button" power="30400" value="删除" class="link_btn del"/>
<?php
}
?>
</td>
</tr>

<?php
}
?>
</table>
{include file="../application/admin/view/layout/page_tpl_new.html" /}
<script type="text/javascript">
function myResearch(){
    var url="/admin/sleepapilog/lists";
    var generaData=$("#serach_section [name^='ser_']");
    var page=$("#cpage").val();
    var param={
        page:page
    };
    getSearchFormData(generaData,param);
    ContentLoadGo(url,param);
}

$(function(){
 //设置搜索栏
 $(".research").unbind().bind("click",function(){
    var page =$(this).attr("page");
    $("#cpage").val(page);
    myResearch();
 });
//删除
$(".del").unbind().bind("click",function(){
   var that =this;
   var url="/admin/sleepapilog/delData";
   var s_id=$(that).parent().parent().attr('data-s_id');
   var param={
           id:s_id
   };
   cofirmsss_tishi(1,'您确定要删除吗?',function(id){

       AjaxRequest(url,param,function(data){
           if(data.err==0)
           {
               SuccessTiShi("操作成功");

               $(that).parent().parent().remove();
               myResearch();
           }
           else
           {
               ErrTiShi("操作失败");
           }
       });

   });
});


//删除
    $(".dataGet").unbind().bind("click",function(){
        var that =this;
        var url="/admin/sleepapilog/dataGet";
        var s_id=$(that).parent().parent().attr('data-s_id');
        var param={
            id:s_id
        };
        cofirmsss_tishi(1,'您确定要再次抓取吗?',function(id){

            AjaxRequest(url,param,function(data){
                if(data.err==0)
                {
                    SuccessTiShi("操作成功,等待系统抓取");
                }
                else
                {
                    ErrTiShi("操作失败");
                }
            });

        });
    });

    $(".info").unbind().bind("click",function(){
        var that =this;
        var url="/admin/sleepapilog/infoData";
        var dataid=$(that).parent().parent().attr('dataid');
        var param={id:dataid};
        ContentLoadGo(url,param);
        //弹出：确认按钮
    });
        	   
//导航
$(".topBannerItem").unbind().bind("click",function(){
   var attArr = $(this).attr();
   goToSelfLink(attArr);

});
//添加
$(".add").unbind().bind("click",function(){
   var that =this;
   var url="/admin/sleepapilog/addData";
   var param={};
   ContentLoadGo(url,param);
     //弹出：确认按钮
});
        	   
//全选
$("#all").unbind().bind("click",function(){
    if(this.checked){
        $(".checkBoxInput").attr("checked", true);
        $(".checkBoxInput").prop("checked", true);
    }else{
        $(".checkBoxInput").attr("checked", false);
        $(".checkBoxInput").prop("checked", false);
    }
    var se=getAllSelectItem();
});

});
</script>
<script>
$(function (){
    $("[data-toggle='tooltip']").tooltip();
});
</script>
{/block}
   